#include "defines.h"

void draw1x(u32 *dest,int destp,u32 *src,int srcp,int w,int h)
{
	int x,y;

	for(y=0;y<h;y++) {
		for(x=0;x<w;x++)
			dest[x + (y * destp)] = src[x + (y * srcp)];
	}
}

void draw2x(u32 *dest,int destp,u32 *src,int srcp,int w,int h)
{
	int x,y;

	for(y=0;y<h;y++) {
		for(x=0;x<w;x++) {
			u32 pixel = src[x + (y * srcp)];

			dest[x*2+0 + ((y*2+0) * destp)] = pixel;
			dest[x*2+1 + ((y*2+0) * destp)] = pixel;
			dest[x*2+0 + ((y*2+1) * destp)] = pixel;
			dest[x*2+1 + ((y*2+1) * destp)] = pixel;
		}
	}
}

void draw3x(u32 *dest,int destp,u32 *src,int srcp,int w,int h)
{
	int x,y;

	for(y=0;y<h;y++) {
		for(x=0;x<w;x++) {
			u32 pixel = src[x + (y * srcp)];

			dest[x*3+0 + ((y*3+0) * destp)] = pixel;
			dest[x*3+1 + ((y*3+0) * destp)] = pixel;
			dest[x*3+2 + ((y*3+0) * destp)] = pixel;
			dest[x*3+0 + ((y*3+1) * destp)] = pixel;
			dest[x*3+1 + ((y*3+1) * destp)] = pixel;
			dest[x*3+2 + ((y*3+1) * destp)] = pixel;
			dest[x*3+0 + ((y*3+2) * destp)] = pixel;
			dest[x*3+1 + ((y*3+2) * destp)] = pixel;
			dest[x*3+2 + ((y*3+2) * destp)] = pixel;
		}
	}
}

void draw4x(u32 *dest,int destp,u32 *src,int srcp,int w,int h)
{
	int x,y;

	for(y=0;y<h;y++) {
		for(x=0;x<w;x++) {
			u32 pixel = src[x + (y * srcp)];

			dest[x*4+0 + ((y*4+0) * destp)] = pixel;
			dest[x*4+1 + ((y*4+0) * destp)] = pixel;
			dest[x*4+2 + ((y*4+0) * destp)] = pixel;
			dest[x*4+3 + ((y*4+0) * destp)] = pixel;
			dest[x*4+0 + ((y*4+1) * destp)] = pixel;
			dest[x*4+1 + ((y*4+1) * destp)] = pixel;
			dest[x*4+2 + ((y*4+1) * destp)] = pixel;
			dest[x*4+3 + ((y*4+1) * destp)] = pixel;
			dest[x*4+0 + ((y*4+2) * destp)] = pixel;
			dest[x*4+1 + ((y*4+2) * destp)] = pixel;
			dest[x*4+2 + ((y*4+2) * destp)] = pixel;
			dest[x*4+3 + ((y*4+2) * destp)] = pixel;
			dest[x*4+0 + ((y*4+3) * destp)] = pixel;
			dest[x*4+1 + ((y*4+3) * destp)] = pixel;
			dest[x*4+2 + ((y*4+3) * destp)] = pixel;
			dest[x*4+3 + ((y*4+3) * destp)] = pixel;
		}
	}
}
